package com.study.dataStructure.leetcode.problems;

/**
 * @author tiny
 * @date 2022/4/27 15:47
 * @Description: 回文数(easy)
 */
public class Palindrome {

    public static void main(String[] args) {
        System.out.println(new Palindrome().isPalindrome(12356321));

    }

    public boolean isPalindrome(int x) {
        String str = x+"";
        int left = 0;
        int right = str.length()-1;
        while(left<right){
            if( str.charAt(left++)!=str.charAt(right--) ){
                return false;
            }
        }
        return true;
    }

}
